//
//  JSelImgBtn.m
//  HeadIndustry
//
//  Created by jun on 2017/9/14.
//  Copyright © 2017年 jun. All rights reserved.
//

#import "JSelImgBtn.h"

@implementation JSelImgBtn

- (id)initWithFrame:(CGRect)frame tag:(NSInteger)tag
{
    self = [super initWithFrame:frame];
    if (self)
    {
        [self setImage:[UIImage imageNamed:@"gophone_icon"] forState:UIControlStateNormal];
        [self configUI:tag];
    }
    return self;
}

- (void)configUI:(NSInteger )tag
{
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = CGRectMake(self.width - 10, - 10, 30, 30);
    [btn setImage:[UIImage imageNamed:@"hui_close"] forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(closeBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    btn.tag = tag;
    [self addSubview:btn];
}

- (void)closeBtnClick:(UIButton *)btn
{
    if (_delImgBtnBlock) {
        _delImgBtnBlock(btn.tag);
    }
}

@end
